﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBHelper.BLL;
using System.Configuration;
using System.Data.SqlClient;
using Maticsoft.Common;

namespace LongQuanWeb.ManagementModule
{
    public enum EducationLevel
    {
        大专 = 0,
        本科 = 1,
        硕士 = 2,
        博士= 3
    }
    public partial class Managementlist : System.Web.UI.Page
    {
        public static IList<DBHelper.Model.Users> m_UserList = null;
        public static DBHelper.Model.Users m_currentUser = null;
        public static DBHelper.BLL.Users m_UserLoader = new Users();
        protected void Page_Load(object sender, EventArgs e)
        {
            string strConn = ConfigurationManager.AppSettings["ConnectionString"];
            SqlConnection ConnSql = new SqlConnection(strConn);
            ConnSql.Open();
            string strSQL = "SELECT username,sex,GraduateYear,Major,Education,IsEmployed, Status FROM Users ";
            SqlDataAdapter adapter = new SqlDataAdapter(strSQL, ConnSql);
            System.Data.DataTable table = new System.Data.DataTable();
            adapter.Fill(table);
            GridView1.DataSource = table;
            GridView1.DataBind();
            m_UserList = m_UserLoader.GetModelList("");
        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = GridView1.SelectedRow;
            string name = row.Cells[1].Text;
            foreach (DBHelper.Model.Users user in m_UserList)
            {
                if (user.UserName == name)
                {
                    m_currentUser = user;
                    Response.Redirect("MemberManagement.aspx?username="+name);
                    return;
                }
            }
        }
    }
}
